package LocalClassifier;

import java.util.ArrayList;

import Definitions.GraphClass;
import Definitions.NodeClass;
import Global.ConstantVariable;
import Global.GlobalClass;
import InputPreparer.InputPreparationMethodInterface;
import Result.EvaluationClass;
import Result.ResultClass;
import Sampling.SamplingAbstractClass;

public class MachineLearningClassifiersClass implements LocalClassifierInterface{

	
	String name;
	ArrayList <InputPreparationMethodInterface> inputPreparer;
	SamplingAbstractClass currentSampling;
	GlobalClass global;
	
	protected MachineLearningClassifiersClass(SamplingAbstractClass currentSampling, GlobalClass global)
	{
		this.currentSampling = currentSampling;
		this.global = global;
	}
	
	public ArrayList<InputPreparationMethodInterface> getInputPreparer() {
		return inputPreparer;
	}

	public void setInputPreparer(ArrayList<InputPreparationMethodInterface> inputPreparer) {
		this.inputPreparer = inputPreparer;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	} 
	public double[] getTrainRatios(String useSet)
	{
		return null;
	}

	/*****************************************************************
	* Function Name:	evaluate
	* Aim: 				
	* Inputs:		 	 		
	* Outputs:			--- 			
	* Data Structures: 	---
	* Algorithms: 		---
	*****************************************************************/
	public ArrayList<Double> evaluate(NodeClass u) //probobilities soft 
	{
		return null;
		
	}
	
	public double[] evaluate(NodeClass testNode, double input[], String usage) //soft 
	{
		return null;
	}
	public double[] evaluate(NodeClass u, String usage,String s) //probobilities crisp
	{
		return null;
	}
	/*****************************************************************
	* Function Name:	initialize parametres
	* Aim: 				
	* Inputs:		 	 		
	* Outputs:			--- 			
	* Data Structures: 	---
	* Algorithms: 		---
	*****************************************************************/
	public void initialize( ArrayList <InputPreparationMethodInterface> inputPrep)
	{
		this.inputPreparer =inputPrep;
	}
	
	/*****************************************************************
	* Function Name:	feature selection -filtering 
	* Aim: 				
	* Inputs:		 	 		
	* Outputs:			--- 			
	* Data Structures: 	---
	* Algorithms: 		---
	*****************************************************************/
	public void inputPreparation()
	{
		
	}
	 
	public void train( GraphClass g)  
	{
		
	}
	
	
	public  ArrayList<Double> getInformationVector(NodeClass u, int whichNodesToUseForAggregation)
	{
		
		ArrayList<Double> input = new ArrayList<Double>(); 
		input.add((double)1);
		for(int i=0;  i<inputPreparer.size() ; i++)
		{
			
			ArrayList <Double> tempInput = inputPreparer.get(i).getInput(u, whichNodesToUseForAggregation);
			
			for(int j=0 ; j< tempInput.size() ; j++)
			{
				input.add(tempInput.get(j));
			}

			tempInput.clear();
		}
		return input;
	}
	
	public  ArrayList<Double> getInputMatrix( ArrayList <NodeClass> nodeList)
	{
		return null;
	}

	public double[] getAlphaForSpecifiedDataSet(ArrayList<NodeClass> dataSet, int nodeIsInTestSetForTheFold) 
	{
		// TODO Auto-generated method stub	
		for(NodeClass node : dataSet)
		{
			this.evaluate(node, nodeIsInTestSetForTheFold, ConstantVariable.LocalClassifier_Constants.SOFT);
		}
		
		EvaluationClass evaluation = new EvaluationClass(currentSampling);
		
		return evaluation.findClasifierAccuracyForAllClasses((evaluation.CreateConfMat(dataSet)));
	}

	@Override
	public void initialize(GraphClass g, ResultClass r) 
	{
		// TODO Auto-generated method stub
	}

	@Override
	public double[] evaluate(NodeClass u, int nodeIsInTestSetForTheFold, String s) 
	{
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void initialize(GraphClass g, ArrayList<Object> paramList) 
	{
		// TODO Auto-generated method stub
		
	}
	
	public void changeSecondLevelClassifierToBeUsed(String newClassifierName)
	{
		
	}

	@Override
	public void setSampling(SamplingAbstractClass sampling) {
		// TODO Auto-generated method stub
		this.currentSampling = sampling;
		
	}

	@Override
	public void train(GraphClass g, SamplingAbstractClass sampling) {
		// TODO Auto-generated method stub
		
	}

}